﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace OpenPhotoAlbum.My
{
	/// <summary>
	/// Summary description for Photos
	/// </summary>
	[WebService(Namespace = "http://tempuri.org/")]
	[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
	[System.ComponentModel.ToolboxItem(false)]
	// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
	[System.Web.Script.Services.ScriptService]
	public class Photos : AlbumWebService
	{

		[WebMethod]
		public void UpdatePhotoTitle(Guid photoId, string caption)
		{
			AssertPhotoOwner(photoId);

			BusinessLogics.PhotoManager.Instance.UpdatePhotoTitle(photoId, caption);
		}

		[WebMethod]
		public string UpdatePhotoTitleWithReturn(Guid photoId, string caption, Guid albumId, string albumTitle)
		{
			AssertPhotoOwner(photoId);

			BusinessLogics.PhotoManager.Instance.UpdatePhotoTitle(photoId, caption);

			return UrlContext.BuildMyPhotoUrl(0, 0, albumId, albumTitle, photoId, caption);
		}

		[WebMethod]
		public void UpdatePhotoDescription(Guid photoId, string description)
		{
			AssertPhotoOwner(photoId);

			BusinessLogics.PhotoManager.Instance.UpdatePhotoDescription(photoId, description);
		}

		[WebMethod]
		public void SaveVisualEffect(Guid photoId, string veName)
		{
			AssertPhotoOwner(photoId);

			BusinessLogics.PhotoManager.Instance.SaveVisualEffect(photoId, veName);
		}

		[WebMethod]
		public void SaveVisualEffectAs(Guid photoId, string veName)
		{
			AssertPhotoOwner(photoId);

			BusinessLogics.PhotoManager.Instance.SaveVisualEffectAs(photoId, veName);
		}

	}
}
